﻿using UnityEngine;
namespace GX
{
    static public class AssetManager
    {
        static IAssetManager _mgr;
        static IAssetManager mgr
        {
            get
            {
                if (null == _mgr)
                    _mgr = App.GetService(App.SERVICE_ASSET_MANAGER) as IAssetManager;
                return _mgr;
            }
        }
        static public void Initialize(MonoBehaviour behaviour, IAssetManifest assetManifest)
        {
            mgr.Initalize(behaviour,assetManifest);
        }
        static public void Load(string assetPath, AssetDelegate onDone, AssetDelegate onProgress=null)
        {
            mgr.Load(assetPath,onDone,onProgress);
        }
        static public void LoadBytes(string assetPath, AssetDelegate onDone, AssetDelegate onProgress = null)
        {
            mgr.LoadBytes(assetPath, onDone, onProgress);
        }
        static public void LoadText(string assetPath, AssetDelegate onDone, AssetDelegate onProgress = null)
        {
            mgr.LoadText(assetPath, onDone, onProgress);
        }
        static public void Unload(string assetPath, AssetDelegate onDone, AssetDelegate onProgress = null)
        {
            mgr.Unload(assetPath, onDone, onProgress);
        }
        static public void Retain(string assetPath)
        {
            mgr.Retain(assetPath);
        }
        static public void Release(string assetPath)
        {
            mgr.Release(assetPath);
        }
        static public void UnloadUnUsedAssets()
        {
            mgr.UnloadUnUsedAssets();
        }
    }
}
